package com.dayu.share.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.dayu.share.mapper.ShareGoodsQualityMapper;
import com.dayu.share.domain.ShareGoodsQuality;
import com.dayu.share.service.IShareGoodsQualityService;

/**
 * 商品成色Service业务层处理
 * 
 * @author HK
 * @date 2021-04-08
 */
@Service
public class ShareGoodsQualityServiceImpl implements IShareGoodsQualityService 
{
    @Autowired
    private ShareGoodsQualityMapper shareGoodsQualityMapper;

    /**
     * 查询商品成色
     * 
     * @param qualityId 商品成色ID
     * @return 商品成色
     */
    @Override
    public ShareGoodsQuality selectShareGoodsQualityById(Long qualityId)
    {
        return shareGoodsQualityMapper.selectShareGoodsQualityById(qualityId);
    }

    /**
     * 查询商品成色列表
     * 
     * @param shareGoodsQuality 商品成色
     * @return 商品成色
     */
    @Override
    public List<ShareGoodsQuality> selectShareGoodsQualityList(ShareGoodsQuality shareGoodsQuality)
    {
        if(shareGoodsQuality.getParams() != null) {
            if(shareGoodsQuality.getParams().get("qualityIds") != null) {
                String ids = (String) shareGoodsQuality.getParams().get("qualityIds");
                shareGoodsQuality.getParams().put("ids", ids.split(","));
            }
        }
        return shareGoodsQualityMapper.selectShareGoodsQualityList(shareGoodsQuality);
    }

    /**
     * 新增商品成色
     * 
     * @param shareGoodsQuality 商品成色
     * @return 结果
     */
    @Override
    public int insertShareGoodsQuality(ShareGoodsQuality shareGoodsQuality)
    {
        return shareGoodsQualityMapper.insertShareGoodsQuality(shareGoodsQuality);
    }

    /**
     * 修改商品成色
     * 
     * @param shareGoodsQuality 商品成色
     * @return 结果
     */
    @Override
    public int updateShareGoodsQuality(ShareGoodsQuality shareGoodsQuality)
    {
        return shareGoodsQualityMapper.updateShareGoodsQuality(shareGoodsQuality);
    }

    /**
     * 批量删除商品成色
     * 
     * @param qualityIds 需要删除的商品成色ID
     * @return 结果
     */
    @Override
    public int deleteShareGoodsQualityByIds(Long[] qualityIds)
    {
        return shareGoodsQualityMapper.deleteShareGoodsQualityByIds(qualityIds);
    }

    /**
     * 删除商品成色信息
     * 
     * @param qualityId 商品成色ID
     * @return 结果
     */
    @Override
    public int deleteShareGoodsQualityById(Long qualityId)
    {
        return shareGoodsQualityMapper.deleteShareGoodsQualityById(qualityId);
    }
}
